<template>
  <div>
    clock:
    <button @click="count++">{{ count }}</button>
    <div v-if="count % 2 === 0" style="font-size: 60px;" v-clock>hello</div>
  </div>
</template>
<script setup>
import { ref } from 'vue';
const h = ref(null)
const count = ref(0)
const vClock = {
  mounted(el) {
    h.value = setInterval(() => {
      el.innerHTML = new Date().toLocaleString();
      console.log('hello clock');
    }, 1000)
  },
  unmounted() {
    clearInterval(h.value);
  }
}

</script>